package com.aaa.day1105.third.demo;

import java.util.Arrays;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * @Description:
 * @author:LiWei
 * @date:2022年11月06日10:36
 */
public class Test1 {
    public static void main(String[] args) {
        Integer [] arr={2,3,4,5,6,2};

        Long collect = Arrays.stream(arr).collect(Collectors.counting());
        System.out.println(collect);

        Double collect1 = Arrays.stream(arr).collect(Collectors.averagingInt(item -> item));
        System.out.println(collect1);


        //Optional<Integer> reduce = Arrays.stream(arr).reduce((t1, t2) -> t1+=t2);
        //System.out.println(reduce.get());
    }
}
